import re
pattern = r'wr_\w+'             #模仿字符串
string = 'MR_SHOP mr_shop'       #要匹配的字符串
match = re.match(pattern,string,re.I)  #匹配字符串，不区分大小写
print(match)
string = '项目名称MR_SHOP mr_shop'
match = re.match(pattern,string,re.I)
print(match)



import re 
pattern = r'mr_\w+'
string = 'MR_SHOP mr_shop'
match = re.match(pattern,string,re.I)
print('匹配值的起始位置：',match.start())
print('匹配值的结束位置：',match.end())
print('匹配位置的元组：',match.span())
print('要匹配的字符：',match.string())
print('匹配数据：',match.group)



import re
pattern = r'[1-9]{1,3}(\.[0-9]{1,3}){3}'
string = '127.0.0.1 192.168.1.66'
match = re.findall(pattern,string)
print(match)



import re
pattern = r'1[34578]\d{9}'
string = '中奖号码为84978981 联系方式：1361111111'
result = re.sub(pattern,'1xxxxxxxxx',string)
print(result)



import re
pattern = r'[?|&]'
url = 'http://localhost:8080/myweb/index.aspx?username=“mr”&pwd=“woshi”'
result = re.split(pattern,url)
print(result)